<?php


class OpenScript extends FaceBase {


	/**
	 * 构造函数
	 *
	 */
	public function __construct(){
		parent::__construct();
		//n_mod("skin")->header();

	}

	public function async(){
		
		
		$pHandle = n_api("project");

		$plist = $pHandle->getAll();
		$conf = n_api("nconfig")->get('project_repost_url','project_repost_port','project_repost_domain');
		
		if(!empty($plist)){
			foreach ($plist as $key => $val) {
				if('blog'==$val['pcode']){
					//continue;
				}
				echo "{$val['pcode']}\n";
				for ($i=0; $i < $val['max_concurrency']; $i++) {
					

					$sdata = $data = $pHandle->getCacheRequest($val['pcode']);
					if(empty($data)){
						break;
					}
					
					parse_str($sdata,$data);
					$data['isAsync'] = 'Y';
					$rs = n_api("common")->curlPost($conf['project_repost_url'],$data,$conf['project_repost_port'],$conf['project_repost_domain']);
					print_r($rs);
					//exit;
				}
			}
		}
		
		
	}


	public function __destruct(){
		//n_mod('skin')->footer();		
	}	
}


?>